// 全局的文件
export default{
  // 所有的消息记录
  historyRecords: [
    {
      targetId: "456",
      messages: [
        {
          id: "b2043743-fcdc-4d68-bd6b-735fef7be025",
          sender: 1,
          type: "text",
          content: "内容2",
          time: "2019-11-23T13:01:41.729Z"
        },
        {
          id: "a3e847d2-eeb2-4206-9807-db8f628aaee4",
          sender: 0,
          type: "text",
          content: "哈哈哈哈3",
          time: "2019-11-23T13:17:38.864Z"
        }
      ]
    }
  ],
  friendList:[
    {
      userName:"admin 张三",
      uid: 'admin',
      avator: 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1574663709829&di=d6f948edc40040307914a3f0e78dfdfb&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fforum%2Fw%3D580%2Fsign%3D3c36dc1eb4096b6381195e583c338733%2F41e29413b07eca80534822d69b2397dda04483a1.jpg',
      content: '张三的个人资料',
      birth: '1999/10/12',
      gender: 1
    },
    {
      userName: "admin2 李四",
      uid: 'admin2',
      avator: 'https://www.10wallpaper.com/wallpaper/1366x768/1809/Universe_colorful_nebula_explosion_art_1366x768.jpg',
      content: '李四的个人资料',
      birth: '1999/12/12',
      gender: 0
    },
    {
      userName: "韩昊",
      uid: '6109117200',
      avator: 'https://www.10wallpaper.com/wallpaper/1366x768/1809/Universe_Newly_Discovered_Dazzling_Planet_1366x768.jpg',
      content: '韩昊的个人资料',
      birth: '1999/12/12',
      gender: 0
    }
  ],
  friendRequests:[
    {
      _id: "6109118",
      type: "send",
      time: "2019-11-28T09:40:50.405Z",
      content: "测试3",
      hasRead: false,
      options: "none",
      tagUserInfo: {
        uid: "6109118",
        gender: 3,
        createTime: "2019-11-28T03:30:51.000Z",
        avator: "https://wx2.sinaimg.cn/mw690/eb5f26acly1g9cnzu0k3oj20go0ciwhx.jpg",
        birth: "2015-10-10T02:09:10.000Z",
        userName: "大米",
        content: "第三个用户",
      }
    },
    {
      _id: "6109117",
      type: "send",
      time: "2019-11-28T09:40:50.405Z",
      content: "测试2",
      hasRead: false,
      options: "none",
      tagUserInfo: {
        uid: "6109118",
        gender: 3,
        createTime: "2019-11-28T03:30:51.000Z",
        avator: "https://wx2.sinaimg.cn/mw690/eb5f26acly1g9cnzu0k3oj20go0ciwhx.jpg",
        birth: "2015-10-10T02:09:10.000Z",
        userName: "小米",
        content: "第二个用户",
      }
    }
  ],
  userInfo:{
    uid: '',
    uName: ''
  },
  addARecord (Friendid, message) {
    var records = this.historyRecords.filter(val => val._id === Friendid)
    records.messages.add(message)
  },
  findFriend(friendid){
    var i
    for(i = 0; i < this.friendList.length; i++) {
      console.log("当前"+i)
      if (this.friendList[i].uid === friendid){
        return this.friendList[i]
      } else {
      }
    }
    return null;
  }
}
